The Image Compression Manager provides two functions and a data structure that allow your application to communicate information to compressors that can constrain compressed data to a specific data rate. Compressors indicate that they can constrain the data rate by setting the following flag in their compressor information structure:
#define codecInfoDoesRateConstrain(1L<<23)
(For details, see "The Compressor Information Structure," .)
The DataRateParams data type defines the data rate parameters structure.
typedef struct {
long dataRate; /* bytes per second */
long dataOverrun; /* number of bytes outside
rate */
long frameDuration; /* in milliseconds */
long keyFrameRate; /* frequency of key frames */
CodecQ minSpatialQuality; /* minimum spatial quality */
CodecQ minTemporalQuality; /* minimum temporal quality */
} DataRateParams;
typedef DataRateParams *DataRateParamsPtr;
The SetCSequenceDataRateParams function allows you to specify the parameters in this structure and the GetCSequenceDataRateParams function allows you to retrieve the parameters.
The SetCSequenceDataRateParams function allows your application to set parameters in the data rate parameters structure, which communicates information to compressors that can constrain compressed data in a particular sequence to a specific data rate.
pascal OSErr SetCSequenceDataRateParams
(ImageSequence seqID,
DataRateParamsPtr params);
If your application is keeping track of data overrun, you should call the SetCSequenceDataRateParams function before each use of the CompressSequenceFrame function (described on CompressSequenceFrame ). If not, you only need to call SetCSequenceDataRateParams before the first use of CompressSequenceFrame , with the dataOverrun parameter of the data rate parameters structure set to 0. In this case, it is assumed that the frame duration is valid for all frames. Setting the dataRate field in the data rate parameters structure to 0 is the same as not performing data rate constraint.
The GetCSequenceDataRateParams function obtains the data rate parameters previously set with the SetCSequenceDataRateParams function, which is described in the previous section.
pascal OSErr GetCSequenceDataRateParams
(ImageSequence seqID,
DataRateParamsPtr params);